package gui;

import java.applet.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class apptest extends Applet {
	Canvas c;
	ScrollPane s;

	public void init() {
		setLayout(new BorderLayout());
		s = new ScrollPane();
		s.setSize(100, 100);
		add("Center", s);
		c = new myCanvas();
		c.setSize(500, 300);
		s.add(c);
	}

	class myCanvas extends Canvas {
		Image buffImage;
		Graphics offscreen;
		boolean initDone = false;

		myCanvas() {
			super();
		}
		
		public void update(Graphics g) {
			g.drawImage(buffImage, 0, 0, this);
		}

		public void initpaint(Graphics g) {
			try {
				buffImage = this.createImage(200, 200);
				offscreen = buffImage.getGraphics();
				offscreen.setColor(Color.white);
				offscreen.fillRect(0, 0, 500, 500);
				offscreen.setColor(Color.blue);
				offscreen.setFont(new Font("Courier", Font.ITALIC, 42));
				offscreen.drawString("Hello World!", 0, 50);
				initDone = true;
				g.drawImage(buffImage, 0, 0, this);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}